package com.tzy.evaluation.mapper;
import com.tzy.common.entity.Evaluation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户评价表 Mapper 接口
 * </p>
 *
 * @author 谭同学
 * @since 2022-03-02
 */
public interface EvaluationMapper extends BaseMapper<Evaluation> {
    @MapKey("id")
    List<Map<String, Object>> findPendingEvaluationListByUserId(int userId);

    List<Evaluation> findEvaluationPageByDishesId(int dishesId,Integer pageNum,Integer size);

    List<Evaluation> findEvaluationListByUserId(int userId,Integer pageNum,Integer size);
    /**
     * 手写分页方法
     * @param pageNum
     * @param size
     * @return
     */
    List<Evaluation> findEvaluationListByPage(@Param("pageNum") Integer pageNum, @Param("size") Integer size);
    @Select(" select count(*) from evaluation ")
    int findTotal();

}
